# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=plasmatube
pkgver=0_git20200413
pkgrel=0
_commit="9abe039f3bc48505b7abfb8c4b231cb26cea7ae0"
pkgdesc="Kirigami YouTube video player based on libmpv and youtube-dl"
arch="all !armhf" # blocked by extra-cmake-modules
url="https://invent.kde.org/lnj/plasmatube"
license="GPL-2.0-only OR GPL-3.0-only"
depends="kirigami2 qt5-qtquickcontrols2"
makedepends="extra-cmake-modules qt5-qtbase-dev qt5-qtsvg-dev qt5-qtquickcontrols2-dev mpv-dev"
source="https://invent.kde.org/lnj/plasmatube/-/archive/$_commit/plasmatube-$_commit.tar.gz"
options="!check" # No tests
builddir="$srcdir/$pkgname-$_commit"

prepare() {
	default_prepare

	# qmlplugindump fails for armv7+qemu (pmb#1970). This is purely for
	# packager knowledge and doesn't affect runtime, so we can disable it.
	if [ "$CARCH" = "armv7" ]; then
		sed -i "s/ecm_find_qmlmodule/# ecm_find_qmlmodule/g" CMakeLists.txt
	fi
}

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	make -C build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" make -C build install
}
sha512sums="3e8995d8ba8a6199c117851b2f1a350f7cdb05f134b5b4412c65356f6f58ce03d2082ac9fc49e3ef90c9e63b957446800f53253011edd9a972f4d441b4451a6c  plasmatube-9abe039f3bc48505b7abfb8c4b231cb26cea7ae0.tar.gz"
